//========encoding:utf-8=========
/*
 * @describe:  三目运算符
 * @author:mhao
 * @copyright:chinasoft.cn
 * @date:2020年3月22日   下午12:41:57
 */
package edu.chinasoft.service;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import edu.chinasoft.domain.Function;
import edu.chinasoft.domain.PageUnitForRole;
import edu.chinasoft.domain.Role;
import edu.chinasoft.mapper.RoleMapper;
@Service("roleService")
public class RoleServiceImp implements RoleService{
	@Autowired
	@Qualifier(value="roleMapper")
	private RoleMapper roleMapper;
	private Logger logger = LoggerFactory.getLogger(RoleServiceImp.class);

	@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
	@Override
	public PageUnitForRole getRecordNum() {
		logger.info("RoleServiceImp>>>getRecordNum start ……");
        PageUnitForRole recordNum = roleMapper.getRecordNum();
        logger.info("RoleServiceImp>>>getRecordNum end ……");
        return recordNum;
	}
	@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
	@Override
	public List<Role> selectUnitRole(Map<String, Object> map) {
		// TODO Auto-generated method stub
		 logger.info("RoleServiceImp>>>selectUnitRole start ……");
	     List<Role> roleList = roleMapper.selectUnitRole(map);
	     logger.info("RoleServiceImp>>>selectUnitRole end ……");
         return roleList;
	}
	@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
	@Override
	public List<Function> selectFunctionByRoleId(Role role) {
		// TODO Auto-generated method stub
		 logger.info("RoleServiceImp>>>selectFunctionByRoleId start ……");
	     List<Function> functionList = roleMapper.selectFunctionByRoleId(role);
	     logger.info("RoleServiceImp>>>selectFunctionByRoleId end ……");
		 return functionList;
	}
	@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
	@Override
	public boolean insertRole(Role role) {
		// TODO Auto-generated method stub
		logger.info("RoleServiceImp>>>insertRole start ……");
		boolean insertRole = roleMapper.insertRole(role);
		logger.info("RoleServiceImp>>>insertRole end ……");
		return insertRole;
	}
	@Override
	public Boolean updateRoleByRoleId(Role role) {
		// TODO Auto-generated method stub
		logger.info("RoleServiceImp>>>updateRoleByRoleId start ……");
		boolean updateRole = roleMapper.updateRoleByRoleId(role);
		logger.info("RoleServiceImp>>>updateRoleByRoleId end ……");
		return null;
	}

}
